package com.easyidea.its.domain.service.tracklog.impl;


import java.util.Collection;
import java.util.Date;
import java.util.List;

import com.easyidea.its.domain.model.passport.TrackLog;
import com.easyidea.its.domain.repository.tracklog.TrackLogRepository;
import com.easyidea.its.domain.service.base.impl.BaseServiceImpl;
import com.easyidea.its.domain.service.tracklog.TrackLogService;
import com.easyidea.its.web.dto.CarSeizureDto;
import com.easyidea.its.web.dto.StatisticsDto;

public class TrackLogServiceImpl extends BaseServiceImpl<TrackLog> implements TrackLogService {

	private TrackLogRepository trackLogRepository;
	
	public TrackLog getLatestTrackLogByCondition(String passPortName, String direction, boolean serarchLeastRecord, Integer tracklogId, Date passTime) {
			return trackLogRepository.getLatestTrackLogByCondition(passPortName, direction, serarchLeastRecord, tracklogId, passTime);
	}

	public TrackLogRepository getTrackLogRepository() {
		return trackLogRepository;
	}

	public void setTrackLogRepository(TrackLogRepository trackLogRepository) {
		this.trackLogRepository = trackLogRepository;
	}

	public List<TrackLog> getTrackLogsByCondition(CarSeizureDto carSeizureDto, int startIndex, int pageSize) {
		// TODO Auto-generated method stub
		return trackLogRepository.getTrackLogsByCondition(carSeizureDto, startIndex, pageSize);
	}

	public int getTrackLogsCountByCondition(CarSeizureDto carSeizureDto) {
		// TODO Auto-generated method stub
		return trackLogRepository.getTrackLogsCountByCondition(carSeizureDto);
	}
	public boolean modifyPlatNumber(Integer id, String plateNumber) {
		TrackLog tl = trackLogRepository.getBeanById(id);
		tl.setPlateNumber(plateNumber);
		trackLogRepository.saveOrUpdateBean(tl);
		return true;
	}
	public Collection<Object[]> statisticsByCondition(StatisticsDto statisticsDto) {
		return trackLogRepository.statisticsByCondition(statisticsDto);
	}
}
